﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Web.UI.MobileControls;

/// <summary>
/// Summary description for UserControl
/// </summary>
public class UserControl
{
	public UserControl()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static bool Login(string username, string password)
    {
        try
        {
            SqlConnection conn = MapConnection.GetConnection();
            string sqlSelect = "SELECT * FROM users WHERE username =@username AND password=@password";
            SqlCommand command = new SqlCommand(sqlSelect, conn);
            command.Parameters.AddWithValue("@username", username);
            command.Parameters.AddWithValue("@password", password);
            SqlDataReader data = command.ExecuteReader();
            //bool f=data.HasRows;
            return data.Read();
        }
        catch (Exception ex)
        {
            return false;
        }
    }

    public static void ViewUserLogin(Label lbl)
    {
        //cLoginName.Text = ;
    }
}
